<template>
  <el-dialog title="核实任务完成情况" :visible.sync="visible" :center="true" width="68%" size="mini" :close-on-click-modal="false">
    <el-descriptions direction="vertical" :column="5" :size="size" border :title=task.title
                     :label-class-name="labelDescStyle">
      <el-descriptions-item label="发布人">
        {{ task.releaseBy }}
      </el-descriptions-item>
      <el-descriptions-item label="开始时间">
        {{ task.startTime }}
      </el-descriptions-item>
      <el-descriptions-item label="结束时间">
        {{ task.endTime }}
      </el-descriptions-item>
      <el-descriptions-item label="汇报频率">
        {{ task.frequency }}
      </el-descriptions-item>
      <el-descriptions-item label="项目号">
        {{ task.projectSn }}
      </el-descriptions-item>
      <el-descriptions-item :span="5" label="任务内容">
        <el-table :data="task.contentSummaries" :show-header="false" size="mini">
          <el-table-column type="index"></el-table-column>
          <el-table-column prop="contentSummary"></el-table-column>
        </el-table>
      </el-descriptions-item>
      <el-descriptions-item :span="5" label="附件">
        <el-table :data="task.attachment" :show-header="false" size="mini">
          <el-table-column type="index"></el-table-column>
          <el-table-column prop="filePath"></el-table-column>
        </el-table>
      </el-descriptions-item>
      <el-descriptions-item :span="5" label="是否延期">
        {{ task.isDelayed }}
      </el-descriptions-item>
      <el-descriptions-item :span="5" v-if="task.isDelayed === '2'" label="延迟原因">
        {{ task.delayReason }}
      </el-descriptions-item>
      <el-descriptions-item :span="5" v-if="task.isDelayed === '2'" label="延期时间">
        {{ task.delayDuration }}
      </el-descriptions-item>
      <el-descriptions-item :span="1">
        <template slot="label">
          上周计划
        </template>
        <el-table :show-header="false" :data="table12">
          <el-table-column type="index"></el-table-column>
          <el-table-column prop="content"></el-table-column>
        </el-table>
      </el-descriptions-item>
      <el-descriptions-item :span="3" label="完成情况">
        <el-table :show-header="false" :data="task.taskCompleteSummaries">
          <el-table-column type="index"></el-table-column>
          <el-table-column prop="taskComplete">
          </el-table-column>
        </el-table>
      </el-descriptions-item>
      <el-descriptions-item :span="1" label="下周工作计划">
        <el-table :show-header="false" :data="task.taskPlanSummaries">
          <el-table-column type="index"></el-table-column>
          <el-table-column prop="taskPlan">
          </el-table-column>
        </el-table>
      </el-descriptions-item>

      <el-descriptions-item :span="1">
        <template slot="label">
          上阶段需要协调的问题
        </template>
        <el-table :show-header="false" :data="table21">
          <el-table-column type="index"></el-table-column>
          <el-table-column prop="content"></el-table-column>
        </el-table>
      </el-descriptions-item>
      <el-descriptions-item :span="3">
        <template slot="label">
          完成情况
        </template>
        <el-radio v-model="radio" label="1">解决</el-radio>
        <el-radio v-model="radio" label="2">未解决</el-radio>
      </el-descriptions-item>
      <el-descriptions-item :span="1" label="计划需要协调解决的问题">
        <el-table :show-header="false" :data="task.taskCoordinateSummaries">
          <el-table-column type="index"></el-table-column>
          <el-table-column prop="taskCoordinate">
          </el-table-column>
        </el-table>
      </el-descriptions-item>
    </el-descriptions>

    <span slot="footer" class="dialog-footer">
    <el-button @click="Visible = false">取 消</el-button>
    <el-button type="primary" @click="report">通 过</el-button>
      <el-button type="primary" @click="rollBack">退 回</el-button>
  </span>
  </el-dialog>
</template>

<script>
export default {
  name: "ApprovalTasks",
  data() {
    return {
      task: {},
      table12:[],
      table21:[],
      radio:''
    }
  },
  computed: {
    visible: {
      get() {
        return this.$store.state.isVisible;
      },
      set(value) {
        this.$store.commit('setIsVisible', value);
      }
    },
  },
  watch: {
    visible(newVal) {
      console.log('Visible changed to: ', newVal);
    }
  },
  methods: {
    rollBack() {
      this.visible = false
    },
    report() {
      this.visible = false
    }
  },
  mounted() {
    const taskId = this.$store.state.taskId;
    this.$http.get(`/task/approval/${taskId}`).then((response) => {
      if (response.data.code == 1) {
        this.task = response.data.data
        console.log(this.task)
      } else {
        alert("获取失败")
      }
    })
  }
}
</script>

<style scoped>

</style>